class StudentModel {
    private rollNo: number = -Infinity;
    private name: string = '';
    public getRollNo(): number {
        return this.rollNo;
    }
    public setRollNo(rollNo: number): void {
        this.rollNo = rollNo;
    }
    public getName(): string {
        return this.name;
    }
    public setName(name: string): void {
        this.name = name;
    }
}

class StudentView {
    public showStudentDetails(name: string, rollNo: number): void {
        console.log(`Name: ${name}, Roll No: ${rollNo}`);
    }
}

class StudentController {
    private model: StudentModel;
    private view: StudentView;
    constructor(model: StudentModel, view: StudentView) {
        this.model = model;
        this.view = view;
    }
    public setStudentName(name: string): void {
        this.model.setName(name);
    }
    public getStudentName(): string {
        return this.model.getName();
    }
    public setStudentRollNo(rollNo: number): void {
        this.model.setRollNo(rollNo);
    }
    public getStudentRollNo(): number {
        return this.model.getRollNo();
    }
    public updateView(): void {
        this.view.showStudentDetails(this.model.getName(), this.model.getRollNo());
    }
}

function getStudent(): StudentModel {
    const student: StudentModel = new StudentModel();
    student.setRollNo(101);
    student.setName("John");
    return student;
}

function main() {
    const model: StudentModel = getStudent();
    const view: StudentView = new StudentView();
    const controller: StudentController = new StudentController(model, view);
    controller.updateView();
    controller.setStudentName("Jane");
    controller.setStudentRollNo(102);
    controller.updateView();
}

main();
